<template>
	<div class="c2">
		<h1>我是Child2组件</h1>
		<h3>我的msg值是：{{msg}}</h3>
		<button @click="sendData">把数据给我哥哥——Child1</button>
	</div>
</template>

<script>
	export default {
		name:'Child2',
		data() {
			return {
				msg:'你好啊！'
			}
		},
		methods: {
			sendData(){
				this.$bus.$emit('xyz',this.msg)
			}
		},
	}
</script>

<style scoped>
	.c2{
		background-color: orange;
		padding: 20px;
	}
</style>